<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta content="width=device-width, initial-scale=1" name="viewport">
    <title>玉灵 QQ:7031633 Email:webrx@126.com</title>
    <meta content="关键字" name="keywords">
    <meta content="简介" name="description">
    <!-- 定时刷新 定时跳转 -->
    <!--<meta content="1;url=#" http-equiv="refresh">-->
    <!--<meta content="5;url=http://www.baidu.com" http-equiv="refresh">-->
</head>

<body>

<a href="javascript:void(0);if(confirm('是不是要删除')) location.href='http://www.baidu.com'">百度</a>
<hr>
<div class="msg"></div>
<div class="dd"></div>
<div class="tt"></div>

<script>
    let now = new Date()
    let y = now.getFullYear()
    let m = (now.getMonth() + 1).toString().padStart(2, 0)
    let d = now.getDate().toString().padStart(2, 0)
    document.querySelector('.dd').innerHTML = `${y}年${m}月${d}日`

    function ttt() {
        let now = new Date()
        let hh = now.getHours().toString().padStart(2, 0)
        let mm = now.getMinutes().toString().padStart(2, 0)
        let ss = now.getSeconds().toString().padStart(2, 0)
        let ts = `${hh}:${mm}:${ss}`
        document.querySelector('.tt').innerHTML = ts
    }

    ttt()

    //每隔1000ms 1s 就执行ttt函数
    let aa = setInterval(ttt, 1000)

    setTimeout(function () {
        clearInterval(aa)
    }, 5000)

    //5000ms 5s执行一次ttt函数
    //setTimeout(ttt, 5000)

    console.log('hello')


    //
    // alert('ok')
    //点击确定返回true
    // let f = confirm('是不是要打开百度')
    // console.log(f)
    //几乎不用
    // document.write('hello')
    //调试输出
    //console.log('world')

    //let age = window.prompt('请输入年龄', 18)
    //document.querySelector('.msg').innerText = `你输入的年龄是:${age}岁。`
</script>
</body>
</html>
